/// From 和 Into
/// 实现From就会默认实现Into
/// 如果类型 U实现了 From<T>，则 T类型实例调用 into 方法就可以转换为类型 U
pub fn start() {
    let person: Person = "hello".into();
    println!("{:?}", person);
    let person = Person::new("ll".to_string());
    println!("{:?}", person);
    let person = Person::new("ll");
    println!("{:?}", person);
}

#[derive(Debug, Ord, PartialOrd, Eq, PartialEq)]
struct Person(String);

impl Person {
    fn new<T: Into<String>>(name: T) -> Self {
        Self(name.into())
    }
}

impl<T> From<T> for Person
where
    T: Into<String>,
{
    fn from(name: T) -> Self {
        Person::new(name)
    }
}

#[derive(Debug, Ord, PartialOrd, Eq, PartialEq)]
struct T(String);
